class Api::V1::RefundPicturesController < Api::V1::BaseController

  def create
    @refund_picture = RefundPicture.new refund_picture_params
    if @refund_picture.save
      render json: { result: true, message: '上传成功.', data: { id: @refund_picture.id, image: @refund_picture.image.url } }, status: :ok
    else
      render json: { result: false, message: '上传失败.' }, status: :ok
    end
  end
  
  def destroy
    @refund_picture = RefundPicture.find params[:id]
    if @refund_picture.destroy
      render json: { result: true, message: '删除成功.' }, status: :ok
    else
      render json: { result: false, message: '删除失败.' }, status: :ok
    end
  end

  private

  def refund_picture_params
    params.require(:refund_picture).permit(:image)
  end
end
